<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box1 {
            width: 300px;
            height: 300px;
            background: #bbb;
            margin: 100px;
            overflow: hidden;
            position: relative;
        }

        .box2 {
            width: 200px;
            height: 200px;
            background: #888;
            margin: 100px;
            overflow: hidden;
            position: relative;
        }

        .box3 {
            width: 100px;
            height: 100px;
            background: #333;
            margin: 100px;
        }
    </style>
</head>

<body>
    <div class="box1">
        <div class="box2">
            <div class="box3"></div>
        </div>
    </div>

    <script>
        var div1 = document.querySelector(".box1");
        var div2 = document.querySelector(".box2");
        var div3 = document.querySelector(".box3");
        
        function getPagePosition(dom) {
            var left = dom.offsetLeft;
            var top = dom.offsetTop;
            var parent = dom.offsetParent;
            while (parent) {
                left += parent.offsetLeft;
                top += parent.offsetTop;
                parent = parent.offsetParent;
            }
            return {
                x: left,
                y: top
            }
        }
    </script>
</body>

</html>
